<template>
	<view class="container">
		<view class="success">
			<image src="@/static/img/register-success.png"></image>
			<view class="text">
				<text>恭喜你注册成功</text>
			</view>
		</view>
		<view class="btn">
			<button @click="startUse">开始使用</button>
		</view>
	</view>
</template>

<script setup>
import useLoginStore from '@/store/login.js'
import useRegisterStore from '@/store/register.js'
const loginStore = useLoginStore()
const registerStore = useRegisterStore()
const startUse = async () => {
	const { name, password } = registerStore
	try {
		const res = await loginStore.loginAccountAction({ name, password })
		uni.switchTab({
			url: '/pages/index/index'
		})
	} catch (err) {
		uni.showToast({
			title: err.message,
			icon: 'error'
		})
	}
}
</script>

<style lang="less" scoped>
.container {
	.success {
		margin-top: 120rpx;
		text-align: center;
		image {
			width: 300rpx;
			height: 300rpx;
		}
		.text {
			margin-top: 60rpx;
			font-family: PingFangSC-Medium;
			font-weight: 500;
			font-size: 48rpx;
			color: #333333;
			letter-spacing: 0;
		}
	}
	.btn {
		margin-top: 120rpx;
		button {
			width: 250rpx;
			height: 80rpx;
			background: #4b96e9;
			border-radius: 44rpx;
			font-weight: 400;
			font-size: 32rpx;
			color: #ffffff;
		}
	}
}
</style>
